package org.rambadger.command.event;


import org.hibernate.validator.constraints.Length;
import org.rambadger.command.validation.UrlIdentifier;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

public class ReviewMessageEdited implements Serializable {
    private static final long serialVersionUID = -2338311159763227516L;

    private final String submitterId;
    private final int submissionId;
    private final String newMessage;

    public ReviewMessageEdited(String submitterId, int submissionId, String newMessage) {
        this.submitterId = submitterId;
        this.submissionId = submissionId;
        this.newMessage = newMessage;
    }

    @UrlIdentifier @NotNull
    public String getSubmitterId() {
        return submitterId;
    }

    @Min(1)
    public int getSubmissionId() {
        return submissionId;
    }

    @Length(max = 4096) @NotNull
    public String getNewMessage() {
        return newMessage;
    }

    public String getFullSubmissionId() {
        return submitterId+"/"+submissionId;
    }

    @Override
    public String toString() {
        return "ReviewMessageEdited{" +
                "submitterId='" + submitterId + '\'' +
                ", submissionId=" + submissionId +
                ", newMessage='" + newMessage + '\'' +
                '}';
    }
}
